<template>
  <div class="box">
    <div id="" style="margin-bottom: 30px;">
      <el-button :type="type=='共享模块配置'?'primary':''" v-has @click="type='共享模块配置'">共享模块配置</el-button>
      <el-button :type="type=='数据封标配置'?'primary':''" v-has @click="type='数据封标配置'">数据封标配置</el-button>
    </div>

    <template v-if="type=='共享模块配置'">
      <el-table ref="multipleTable" :data="tableData1" border tooltip-effect="dark" fit stripe highlight-current-row>
        <el-table-column type="selection"></el-table-column>
        <el-table-column v-for="item in tableHead1" :key="item.id" :label="item.label" :prop="item.title"
          align="center">
          <template v-slot="scope">
            <div v-if="item.title!='status'">
              {{scope.row[item.title]}}
            </div>
            <div v-else>
              <el-button type="primary" size="mini" v-if="!scope.row[item.title]"
                @click="scope.row[item.title]=1,start()">启用
              </el-button>
              <el-button type="primary" size="mini" v-if="scope.row[item.title]" @click="scope.row[item.title]=0,end()">
                停用
              </el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </template>
    <template v-if="type=='数据封标配置'">
      <el-table ref="multipleTable" :data="tableData2" border tooltip-effect="dark" fit stripe highlight-current-row>
        <el-table-column type="selection"></el-table-column>
        <el-table-column v-for="item in tableHead2" :key="item.id" :label="item.label" :prop="item.title"
          align="center">
          <template v-slot="scope">
            <div v-if="item.title!='oper2'">
              {{scope.row[item.title]}}
            </div>
            <div v-else>
              <el-button type="primary" size="mini">明细查询</el-button>
              <el-button type="primary" size="mini">明细统计</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </template>

  </div>
</template>

<script>
  export default {
    data() {
      return {
        ruleForm: {},
        formData: {},
        ruleForm1: {},
        formData1: {},
        ruleForm2: {},
        formData2: {},
        fileList: [],
        type: '数据导入',
        tableHead1: [{
            id: 1,
            label: "数据名称",
            title: "name",
          },
          {
            id: 2,
            label: "创建人",
            title: "createUser",
          },
          {
            id: 3,
            label: "类型",
            title: "type",
          },
          {
            id: 4,
            label: "被订阅总数",
            title: "followNum",
          },
          {
            id: 5,
            label: "创建时间",
            title: "createTime",
          },
          {
            id: 6,
            label: "状态",
            title: "status",
          }
        ],
        tableData1: [{
            name: "test",
            createUser: '重庆发布方',
            type: '安全事件',
            followNum: '10',
            createTime: '2021-10-26 11:42:22',
            status: 0
          },
          {
            name: "数据1",
            createUser: '重庆发布方',
            type: '安全事件',
            followNum: '1',
            createTime: '2021-10-24 18:42:22',
            status: 0
          }
        ],

        formData: {},

        tableHead2: [{
            id: 1,
            label: "编号",
            title: "id",
          },
          {
            id: 2,
            label: "模块",
            title: "moudle",
          },
          {
            id: 3,
            label: "封装",
            title: "packing",
          }
        ],
        tableData2: [{
            id: "1",
            moudle: '数据模块',
            packing: '封装A'
          },
          {
            id: "2",
            moudle: '数据模块',
            packing: '封装B'
          },
          {
            id: "3",
            moudle: '数据模块',
            packing: '封装C'
          },
          {
            id: "4",
            moudle: '数据模块A',
            packing: '封装E'
          }
        ]

      };
    },
    computed: {
      uploadFile() {
        return process.env.VUE_APP_BASE_API + "/dc/importCustomer";
      },
      headers() {
        const head = {
          token: this.$store.getters.token,
        };
        return head;
      },
    },
    methods: {
      submitForm() {
        this.$message({
          type: "success",
          message: '上传目录成功'
        })
      },
      resetForm() {

      },
      start() {
        this.$message({
          type: 'success',
          message: '启用成功'
        })
      },
      end() {
        this.$message({
          type: 'error',
          message: '暂停成功'
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
  .box {
    padding: 30px;
  }
</style>
